
// 礼物字典
// id和value为唯一标识
// status: 0删除 1正常
// label：中文名； labelEn：英文名
// url: 图片链接
export const giftList = [
  { id: '1', status: '1', value: 'flower', label: '鲜花', labelEn: 'Flower', url: require('@/assets/gift/flower.png') },
  { id: '2', status: '1', value: 'love', label: '爱心', labelEn: 'Love', url: require('@/assets/gift/love.png') },
  { id: '3', status: '1', value: 'gift', label: '礼物', labelEn: 'Gift', url: require('@/assets/gift/gift.png') },
  { id: '4', status: '1', value: 'applause', label: '喝彩', labelEn: 'Applause', url: require('@/assets/gift/applause.png') },
  { id: '5', status: '1', value: 'sunshine', label: '阳光', labelEn: 'Sunshine', url: require('@/assets/gift/sunshine.png') },
  { id: '6', status: '1', value: 'cake', label: '蛋糕', labelEn: 'Cake', url: require('@/assets/gift/cake.png') },
  { id: '7', status: '1', value: 'fireworks', label: '礼花', labelEn: 'Fireworks', url: require('@/assets/gift/fireworks.png') },
  { id: '8', status: '1', value: 'praise', label: '点赞', labelEn: 'Praise', url: require('@/assets/gift/praise.png') }
]

export function getGiftInfo(id) {
  let obj
  giftList.forEach(item => {
    if (item.id === id) obj = item
  })
  return obj
}

export function getGiftList(pageSize) {
  const arr = []
  const pageNum = Math.ceil(giftList.length / (pageSize || 0))
  for (let i = 1; i < pageNum + 1; i++) {
    const giftArr = []
    const startNum = (i - 1) * pageSize
    const endNum = i * pageSize
    for (let j = startNum; j < endNum; j++) {
      if (giftList[j]) giftArr.push(giftList[j])
    }
    arr.push({
      id: String(i),
      giftArr
    })
  }
  return arr
}
